<?php

class ValidationResult
{
    /**
     *
     * @var boolean
     */
    private $valid;

    /**
     *
     * @var array
     */
    private $validationMessages = array();

    /**
     *
     * @param boolean $valid
     * @param array $validationMessages 
     */
    public function __construct($valid, array $validationMessages)
    {
        $this->valid = (bool) $valid;
        $this->validationMessages = $validationMessages;
    }

    /**
     *
     * @param string $message
     * @return ValidationResult
     */
    public function addValidationMessage($message)
    {
        $this->validationMessages[] = $message;
        return $this;
    }

    /**
     *
     * @return boolean
     */
    public function isValid()
    {
        return $this->valid;
    }

    /**
     *
     * @return array
     */
    public function &getValidationMessages()
    {
        return $this->validationMessages;
    }

    /**
     *
     * @param boolean $valid
     * @return ValidationResult 
     */
    public function setValid($valid)
    {
        $this->valid = (bool)$valid;
        return $this;
    }


}